<template>
  <div class="hello-ezuikit-js">
    <div id="video-container" style="width:600px;height:400px"></div>
  </div>
</template>

<script>
  import EZUIKit from "ezuikit-js";
  let player = null;
export default {
    name: "EZUIKitVedio",
    props: {
      url: {
        default:'',
        type: String,
        required:true
      },
      token: {
        default: 'at.8pwptqmadmh7is6s7vajkae1dfhocuu4-7p2outr4qy-08xkoge-llfexlbvu',
        type: String,
        required:true
      }
    },
    watch:{
      url(val){
        this.url = val;
      },
      token(val){
        this.token = val;
      }
    },
    mounted(){
      console.group("mounted 组件挂载完毕状态===============》");
      console.log(this.url + this.token)
      player = new EZUIKit.EZUIKitPlayer({
          id: 'video-container', // 视频容器ID
          accessToken: this.token,
          url: this.url,
          template: 'simple', // simple - 极简版;standard-标准版;security - 安防版(预览回放);voice-语音版; theme-可配置主题；
          plugin: ['talk'],                       // 加载插件，talk-对讲
          width: 600,
          height: 400,
        });
    },
    methods: {
      change() {
        player.stop();
        // 切换为直播
        player.play({
          url:this.url
        })
      },
    }
  };
</script>
